#include "Points.h"
#include "Fysics/Renderer/Renderer.h"
#include "Fysics/System/ResourceManager.h"

Points::Points(const std::vector<glm::vec3>& points, const glm::vec4& color, float radius)
	: Object("", "", glm::vec3(0), glm::vec3(0), glm::vec3(1)), m_Color(color), m_Radius(radius)
{
	Fysics::VertexBuffer* vb = Fysics::VertexBuffer::Create(points.data(), points.size(), sizeof(glm::vec3));
	Fysics::BufferLayout layout = {
		{ Fysics::ShaderDataType::Float3, "position" }
	};
	vb->SetLayout(layout);

	m_VertexArray = Fysics::VertexArray::Create();
	m_VertexArray->AddVertexBuffer(vb);

	m_Shader = Fysics::ResourceManager::GetInstance()->GetShaderProgram("Line");
}

void Points::Draw() const
{
	Fysics::Renderer::SubmitModelMatrix(GetModelMatrix());
	Fysics::Renderer::DrawPoints(m_Shader, m_VertexArray, m_Radius, m_Color);
}

Points& Points::addPoint(const glm::vec3& position)
{
	
	return *this;
}
